﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBTMDT.Dal;

namespace DBTMDT.Biz
{
    class BizLoaiSanPham
    {
        public int IdLoaiSanPham { get; set; }
        public string MaLoaiSanPham { get; set; }
        public string TenLoaiSanPham { get; set; }

        public BizLoaiSanPham()
        {
            this.IdLoaiSanPham = -1;
        }

        public BizLoaiSanPham(int IdLoaiSanPham, string MaLoaiSanPham, string TenLoaiSanPham)
        {
            this.IdLoaiSanPham = IdLoaiSanPham;
            this.MaLoaiSanPham = MaLoaiSanPham;
            this.TenLoaiSanPham = TenLoaiSanPham;
        }

        public BizLoaiSanPham(string MaLoaiSanPham, string TenLoaiSanPham)
        {
            
            this.MaLoaiSanPham = MaLoaiSanPham;
            this.TenLoaiSanPham = TenLoaiSanPham;
        }

        public void Save()
        {
            if (this.IdLoaiSanPham == -1)
                this.IdLoaiSanPham = DalLoaiSanPham.Insert(this);
            else
                DalLoaiSanPham.Update(this);
        }
    }
}
